<?php if(!defined('HDWIKI_ROOT')) exit('Access Denied');?>
<?php include $this->gettpl('header');?>
<?php if($audit) { ?>
<script>
	function partsection(){
		$('#fullsection').css('display','block');
		$('#partsection').css('display','none');
		$("#hidesection > li:gt(3)").css('display','none');
	}
	function fullsection(){
		$('#fullsection').css('display','none');
		$('#partsection').css('display','block');
		$("#hidesection > li:gt(3)").css('display','block');
	}
	function unexcellent(){
		$.post(
			"index.php?edition-unexcellent",{eid:<?php echo $edition['eid']?>},
			function(xml){
				var message=xml.lastChild.firstChild.nodeValue;
				if(message=='1'){
					alert('设置保存成功!');
				}else if(message=='-1'){
					alert('参数错误');
				}else{
					alert('操作失败');
				}
			}
		);
	}
</script>
<?php } ?>
 
<div class="w-950 hd_map">
<a href="index.php" target="_blank"><?php echo $setting['site_name']?></a> &gt;&gt; <a href="index.php?doc-view-<?php echo $edition['did']?>"><?php echo $edition['title']?></a> &gt;&gt; 历史版本
</div>
<div class="l w-710 o-v">
<h1 class="title_thema bor_b-ccc">
	<strong class="l">
	<?php if($doc['version']== 0 || $doc['version']== $doc['editions']) { ?>
	最新历史版本
	<?php } else { ?>
	历史版本<?php echo $doc['version']?>
	<?php } ?>
	:<?php echo $edition['title']?>
	</strong><a href="index.php?doc-view-<?php echo $edition['did']?>" target="_self" class="r">返回词条</a></h1>
<ul id="cklsbb">
	<li>
	编辑时间:<label><?php echo $edition['time']?></label>
	<label class="baike-a">历史版本:
	<?php if($doc['version']!= 0 && $doc['version']!= $doc['editions']) { ?>
	<a href="index.php?edition-view-<?php echo $edition['latest']?>-0">最新历史版本</a>
	<?php } ?>
	<?php if($doc['version']== 0 || $doc['version']>1) { ?>
	<a href="index.php?edition-view-<?php echo $edition['previous']?>-<?php echo $doc['version']-1?>">上一历史版本</a>
	<?php } ?>
	<?php if($doc['version']!= 0 && $doc['version']<$doc['editions']) { ?>
	<a href="index.php?edition-view-<?php echo $edition['next']?>-<?php echo $doc['version']+1?>">下一历史版本</a>
	<?php } ?>
	</label>
	</li>
	<li>内容长度:<label><?php echo $edition['words']?> </label>图片数:<label><?php echo $edition['images']?></label>目录数:<label><?php echo count($sectionlist)?></label></li>
	<li>修改原因:<label class="orange"><?php if($edition['reason']!='') { ?><?php echo $edition['reason']?><?php } else { ?> <?php } ?></label></li>
</ul>
	
	<div class="content_1 wordcut">				
		<?php foreach((array)$edition['sectionlist'] as $key=>$section) {?>
		<?php if($section['flag'] == 1) { ?>	
		<?php if(($key==1)&&!empty($sectionlist)) { ?>
		<fieldset id="catalog">
			<legend><a name='section'>目录</a></legend>
			<ul id="hidesection">
				<?php foreach((array)$sectionlist as $k=>$sec) {?>
				<li <?php if($k>=4) { ?>style="display:none"<?php } ?>>&#8226; <a href="#<?php echo $sec['key']?>"><?php echo $sec['value']?></a></li>
				<?php }?>
			</ul>
			<?php if(count($sectionlist) > 4) { ?>
			<p><a href="javascript:void(0);" onclick="partsection();"  id="partsection" style="display:none">[显示部分]</a><a href="javascript:void(0);" onclick="fullsection();" id="fullsection">[显示全部]</a></p>
			<?php } ?>
		</fieldset>
		<?php } ?>
		<h3><span class="texts"><?php echo $section['value']?></span><a href="#section">回目录</a></h3>
		<?php } else { ?>	
		<div class="content_topp">
		<?php echo $section['value']?>
		</div>
		<?php } ?>	
		<?php }?>
	</div>

	<div class="bor-ccc m-t10 bg-gray notes add">
		<p class="i6-ff">
		<label class="l w-550"><b>标签:</b>
			<?php foreach((array)$doc['tag'] as $key=>$tag) {?> <a href="index.php?search-tag-<?php echo $tag?>" ><?php echo $tag?></a> <?php }?>
		</label>
		</p>
	</div>
	
</div>
<div class="r w-230">
	<div class="columns ctxx">
	<h2 class="col-h2">词条信息</h2>
	<?php if($author) { ?>
	<dl class="col-dl twhp2">
	<dd><a href="index.php?user-space-<?php echo $edition['authorid']?>" target="_blank"  class="a-img1"><img src="<?php if($author['image']) { ?><?php echo $author['image']?><?php } else { ?>style/default/user_l.jpg<?php } ?>" width="38px" height="38px"/></a></dd>
	<dt><a href="index.php?user-space-<?php echo $edition['authorid']?>" target="_self"><?php echo $edition['author']?></a></dt>
	<dd><span style="color:<?php echo $author['color']?>" class="l m-r8"><?php echo $author['grouptitle']?></span>
	<span title="星星数 <?php echo $author['stars']?>" class="l"><?php for($i=0; $i<$author['editorstar'][3]; $i++) {?><img src="style/default/star_level3.gif"/><?php } ?><?php for($i=0; $i<$author['editorstar'][2]; $i++) {?><img src="style/default/star_level2.gif"/><?php } ?><?php for($i=0; $i<$author['editorstar'][1]; $i++) {?><img src="style/default/star_level1.gif"/><?php } ?></span>
	</dd>
	<dd>版本创建者 <a onclick="return Message.box('<?php echo $edition['author']?>')" href="javascript:void(0)">发短消息</a> &nbsp;&nbsp;<img src="style/default/jb.gif" title="<?php echo $author['credit1']?>金币"></dd>
	</dl>
	<?php } else { ?>
	<dl class="col-dl twhp2">
	<dd><a class="a-img1">
	<img alt="已删除" src="style/default/user_l.jpg" width="38px" height="38px" /></a></dd>
	<dt>此用户已删除</dt>
	<dd>版本创建者</dd>
	</dl>
	<?php } ?>
		
	<ul class="col-ul bor-ccc">
	<li>浏览次数: <?php echo $doc['views']?>  次</li>
	<li>编辑次数: <?php echo $doc['editions']?> 次 <a href="index.php?edition-list-<?php echo $doc['did']?>" class="m-18" >历史版本</a></li>
	<li>更新时间: <?php echo $doc['lastedit']?></li>
	</ul>

	</div>
	<!--
	<div class="ad">
	<a href="#" target="_blank"><img src="style/default/ad-230.jpg"/></a>
	</div>
	-->
	<?php if($audit) { ?>
	<div class="columns ctgl">
	<h2 class="col-h2">版本管理</h2>
	<form method="post">
	<dl>
	<dd class="a-c"><input name="Button2" type="button" value="删除版本" class="m-lr8 btn_inp" onclick="window.location='index.php?edition-remove-<?php echo $doc['did']?>-<?php echo $edition['eid']?>'"/><input name="Button3" type="button" value="取消优秀" class="m-lr8 btn_inp" onclick="unexcellent();"/>
	</dd>
	</dl>
	</form>
	</div>
	<?php } ?>
</div>
<?php include $this->gettpl('footer');?>